import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [{
        path: '/',
        name: 'Home',
        redirect: "/Home"
    },
    {
        path: '/Home',
        name: 'Home',
        component: () =>
            import ('../views/Home.vue'),
        children: [{
                path: 'DianYing', //电影
                name: 'DianYing',
                redirect: "/Home/Dianying/Daiying", //二次重定向到待映
                component: () =>
                    import ('../views/home/DianYing.vue'),
                meta: {
                    name: "电影"
                },
                children: [{
                        path: 'Reying', //电影下的——热映
                        name: 'Reying',
                        component: () =>
                            import ('../views/Dianying/Reying.vue'),
                        meta: {
                            name: "电影-热映"
                        }
                    },
                    {
                        path: 'Daiying', //电影下的——待映
                        name: 'Daiying',
                        component: () =>
                            import ('../views/Dianying/Daiying.vue'),
                        meta: {
                            name: "电影——待映"
                        }
                    },
                ]
            },
            {
                path: 'YingYuan', //影院
                name: 'YingYuan',
                component: () =>
                    import ('../views/home/YingYuan.vue'),
                meta: {
                    name: "影院"
                }
            },
            {
                path: 'YanChu', //演出
                name: 'YanChu',
                component: () =>
                    import ('../views/home/YanChu.vue'),
                meta: {
                    name: "演出"
                }
            },
            {
                path: 'My', //我的
                name: 'My',
                component: () =>
                    import ('../views/home/My.vue'),
                meta: {
                    name: "我的"
                }
            },
        ]
    },
    {
        path: "/Detail/:id", //详情页
        name: 'Detail',
        component: () =>
            import ('../views/Detail.vue'),
    },
    {
        path: "/Login", //登录页
        name: 'Login',
        component: () =>
            import ('../views/Login.vue'),
    },


]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router